# -*- coding: utf-8 -*-
'''
Created on Dec 19, 2013

@author: LONG HOANG GIANG
'''
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
import lib

urlList = {'Hẹn hò': ['http://www.hellochao.vn/chi-tiet-playlist/hen-ho/?plid=45c46cce2e2d7fbd5a1a8c51c7c6a9My'],
           'Thành ngữ': ['http://www.hellochao.vn/chi-tiet-playlist/thanh-ngu-va-tuc-ngu-viet-nam-1/?plid=eccb287e4b5ce2fe58308fd9f2a7b3My'],
           '50 Câu nói hay trong ngày': ['http://www.hellochao.vn/chi-tiet-playlist/thanh-ngu-va-tuc-ngu-viet-nam-1/?plid=eccb287e4b5ce2fe58308fd9f2a7b3My'],
           'Câu nói thông dụng hàng ngày': ['http://www.hellochao.vn/chi-tiet-playlist/cau-noi-thong-dung-hang-ngay/?plid=a87f7679a2f3e71d5181867b754214My'],
           'Đàm thoại thông dụng': ['http://www.hellochao.vn/chi-tiet-playlist/cac-cau-dam-thoai-thong-dung/?plid=1679191c5a880faf5fb536087eb1b6My']}


def getCapCauThongDung():
    
    url = 'http://www.hellochao.vn/chi-tiet-playlist/cac-cau-dam-thoai-thong-dung/?plid=1679191c5a880faf5fb536087eb1b6My'
    tree = lib.Web.load(url).build_tree()
    for node in tree.xpath("//div[@class='playlist-content']/ul[@class='playlist']/li"):
        en = lib.stringify(node.xpath(".//div[@class='lang en']"))
        vi = lib.stringify(node.xpath(".//div[@class='lang vi']"))
        print en, vi
        
        
if __name__ == '__main__':
    
    getCapCauThongDung()
    
    print 'Finished'
    sys.exit(0)